<template>
  <div>
    <el-dialog title="明星信息" :visible.sync="dialogFormVisible"  :loading="loading" width="800px">
      <el-form :model="star">
        <el-form-item label="明星编号" :label-width="formLabelWidth" prop='starId'>
          <el-input v-model="star.starId" autocomplete="off" :readonly="readonly"></el-input>
        </el-form-item>
        <el-form-item label="主人公编号" :label-width="formLabelWidth" prop='starUserId'>
          <el-input v-model="star.starUserId" autocomplete="off" :readonly="readonly"></el-input>
        </el-form-item>
        <el-form-item label="标题" :label-width="formLabelWidth" prop='starTitle'>
          <el-input v-model="star.starTitle" autocomplete="off" :readonly="readonly"></el-input>
        </el-form-item>
        <el-form-item label="推选单位" :label-width="formLabelWidth" prop='starHost'>
          <el-input v-model="star.starHost" autocomplete="off" :readonly="readonly"></el-input>
        </el-form-item>
        <el-form-item label="主人公姓名" :label-width="formLabelWidth" prop='starUserName"'>
          <el-input v-model="star.starUserName" autocomplete="off" :readonly="readonly"></el-input>
        </el-form-item>
        <el-form-item label="学部编号" :label-width="formLabelWidth" prop='starPartId'>
          <el-input v-model="star.starPartId" autocomplete="off" :readonly="readonly"></el-input>
        </el-form-item>
        <el-form-item label="主人公学部名" :label-width="formLabelWidth" prop='starUserPartName'>
          <el-input v-model="star.starUserPartName" autocomplete="off" :readonly="readonly"></el-input>
        </el-form-item>
        <el-form-item label="主人公班级名" :label-width="formLabelWidth" prop='starUserClassName'>
          <el-input v-model="star.starUserClassName" autocomplete="off" :readonly="readonly"></el-input>
        </el-form-item>
        <el-form-item label="点赞数量" :label-width="formLabelWidth" prop='starLikeCount'>
          <el-input v-model="star.starLikeCount" autocomplete="off" :readonly="readonly"></el-input>
        </el-form-item>
        <el-form-item label="明星状态" :label-width="formLabelWidth" prop='starStatus'>
          <el-input v-if="star.starStatus=='0'" value="审核中" autocomplete="off" :readonly="readonly"></el-input>
          <el-input v-if="star.starStatus=='1'" value="已公布" autocomplete="off" :readonly="readonly"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormVisible = false">关 闭</el-button>
      </div>
    </el-dialog>

  </div>
</template>

<script>
  import {
    getStarByStarId
  } from '../../api/star.js'
  export default {
    components: 'Info',
    name: 'Info',
    props: {
      starId: String,
      show: {
        default: false,
        require: true
      }
    },
    data() {
      return {
        star: {},
        loading: false,
        dialogFormVisible: false,
        formLabelWidth: '150px',
        title: '查看明星信息',
        readonly: true,
      }

    },
    create() {

    },
    methods: {

      showInfo(starId) {
        console.log(starId)
        this.title = "查看明星信息"
        this.readonly = true
        this.fetchData(starId)
      },
      fetchData(starId) {
        console.log(starId)
        this.loading = true
        getStarByStarId(starId).then((data) => {
          this.star = data.obj
          console.log(data)
          console.log(this.star)
          this.loading = false
          this.dialogFormVisible = true
        })
        
      }
    },
    watch: {}

  }
</script>

<style scoped>

</style>
